package com.example.demo.config;

import com.example.demo.filter.EncryptInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class EncryptConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        EncryptInterceptor encryptInterceptor = new EncryptInterceptor();
        InterceptorRegistration interceptorRegistration = registry.addInterceptor(encryptInterceptor);
        interceptorRegistration.addPathPatterns("/**");
        List<String> patterns = new ArrayList<>();
        interceptorRegistration.excludePathPatterns(patterns);
    }

}
